cd "C:\"
clear
set memory 32000
use "C:\ISQPaper\BritishAcademy\Allmonths\allmonthsfull.dta", clear
 
#delimit ;

gen pkeep=q2001;
recode pkeep (5=1) (4=2) (3=3) (2=4) (1=5) (6=.);

gen euro=q27;
recode euro(3=1) (2=3) (1=5);

gen milspnd=q202;
recode milspnd (5=1) (4=2) (3=3) (2=4) (1=5) (6=.);

gen unapp=q203;
recode unapp (1=1) (2=2) (3=3) (4=4) (5=5) (6=.);

gen fterror=q205;
recode fterror (1=1) (2=2) (3=3) (4=4) (5=5) (6=.);

gen mbases=q206;
recode mbases (5=1) (4=2) (3=3) (2=4) (1=5) (6=.);

gen immig=q164;
recode immig (5=1) (4=2) (3=3) (2=4) (1=5) (6=.);

gen asylum=q214;
recode asylum (1=1) (2=2) (3=3) (4=4) (5=5) (6=.);

gen highed=0;
recode highed 0=1 if q112>3;


gen male=0;
recode male 0=1 if q2==1;

gen seeng=0;
recode seeng 0=1 if q1==7;

gen sweng=0;
recode sweng 0=1 if q1==8;

gen midland=0;
recode midland 0=1 if q1==2;
recode midland 0=1 if q1==10;

gen north=0;
recode north 0=1 if q1==4;
recode north 0=1 if q1==5;
recode north 0=1 if q1==11;

gen scotland=0;
recode scotland 0=1 if q1==6;

gen wales=0;
recode wales 0=1 if q1==9;

gen ownhom=0;
recode ownhom 0=1 if q108==1;

gen age1=q3;
recode age1 91=.;
recode age1 1=.;
recode age1 2=.;

gen age=108-age1;
replace age=47 if age==.;

gen income=q121;
recode income .=6;

gen union=0;
recode union 0=1 if q118==1;

gen retev=q20;
recode retev (1=5) (2=4) (3=3) (4=2) (5=1) (else=3);

 

gen hcrime=q62;
recode hcrime (1=5) (2=4) (3=3) (4=2) (5=1) (else=3);

gen heduc=q63;
recode heduc (1=5) (2=4) (3=3) (4=2) (5=1) (else=3);

gen hnhs=q65;
recode hnhs (1=5) (2=4) (3=3) (4=2) (5=1) (else=3);

gen hrail=q67;
recode hrail (1=5) (2=4) (3=3) (4=2) (5=1) (else=3);

gen hasyl=q64;
recode hasyl (1=5) (2=4) (3=3) (4=2) (5=1) (else=3);

gen hterr=q66;
recode hterr (1=5) (2=4) (3=3) (4=2) (5=1) (else=3);



/*  Dependent Variables */
 
gen felbrown=q24;
gen felcamer=q25;
gen felcleg=q26;

gen labid=0;
recode labid 0=1 if q32==2;

gen toryid=0;
recode toryid 0=1 if q32==1;

gen libdid=0;
recode libdid 0=1 if q32==3;

keep w8nonpol w8 pkeep euro milspnd unapp fterror mbases immig asylum highed male
seeng sweng midland north scotland wales ownhom age union
income retev
hcrime heduc hnhs hrail hasyl hterr felbrown felcamer
felcleg labid toryid libdid;

